﻿#ifndef XQPUSHCLIENT_H
#define XQPUSHCLIENT_H
#include"XQHead.h"
#include"XSymbolOverload.h"
#include"XQHttpRequestAccount.h"
#include"XQPush.h"
#include"XQHttpHeadReply.h"
//推送客户端
class XQPushClient :public XQHttpRequestObject
{
	Q_OBJECT
public:
	XQPushClient(QObject* parent = nullptr);
	~XQPushClient();
	XQPush::Error error();
	XQHttpRequestAccount* account()const;
public:

public:
	//void setName(const QString& name) override;
	void bindName(QString* name)override;
	void setHttp(XQHttpClient* http) override;
signals://信号
	//发生错误
	void errorOccurred(XQPush::Error error);
protected:
	void init();
	void account_init();
	//发送数据发之前先加密
	void send(const QByteArray& data);
protected slots:
	//响应处理
	void replyRead(const XQHttpHeadReply& head);
	//结果处理
	void resultProcessing(XQPush::Result result);
protected:
	XQHttpRequestAccount* m_account = nullptr;
	XQUserInfo* m_userInfo = nullptr;
	XQPush::Error m_error= XQPush::Error::NoError;//错误
};
#endif